home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / c / library / dos / tvision / dpmi / dpmirun / exedef.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-05-28  |  5.5 KB  |  204 lines

  1. //=====================================================================
  2. //
  3. //  exedef.h
  4. //
  5. //  structures describing the format of executable files.
  6. //
  7. //  Copyright (c) 1994, Kevin Morgan, All rights reserved.
  8. //
  9. //=====================================================================
  10. #ifndef __EXEDEF_H__
  11. #define __EXEDEF_H__
  12.  
  13. //=====================================================================
  14. //
  15. //  HEADER is the header from a normal executable code file
  16. //  (also present before the "NE" new executable header).
  17. //
  18. //=====================================================================
  19. struct HEADER {
  20.     char signature[2];
  21.     WORD lastpagebytes;    /* number of bytes in last page of .exe */
  22.     WORD numpages;        /* number of pages in the executable */
  23.     WORD numreloc;        /* number of relocation entries */
  24.     WORD headersize;    /* header size in paragraphs */
  25.     WORD minalloc;        /* minimum paragraphs in addition to exe size */
  26.     WORD maxalloc;        /* maximum paragraphs */
  27.     WORD initialss;        /* relative to start of exe */
  28.     WORD initialsp;
  29.     WORD checksum;        /* ones complement of sum of all words in executable */
  30.     WORD initialip;        /* relative to start of exe */
  31.     WORD initialcs;
  32.     WORD relocoffs;        /* offset within header of relocation table */
  33.     WORD overlaynum;    /* overlay number 0000h = main program */
  34.     WORD junk_14, junk_15;
  35.     WORD morejunk[16];
  36. };
  37.  
  38. //=====================================================================
  39. //
  40. //  NEHEADER is the header from a "NE" new executable code file
  41. //
  42. //=====================================================================
  43. struct NEHEADER {
  44.     char signature[2];  // "NE"
  45.     BYTE linkMajor, linkMinor;
  46.     WORD entryOffset;   // offset to entry table
  47.     WORD entryLength;   // length of entry table in bytes
  48.     DWORD crc;          // file load CRC (0 in Borland's TPW
  49.     BYTE  programFlags;
  50.     BYTE  applicationFlags;
  51.     WORD  dataSegmentIndex;
  52.     WORD  initialHeapSize;
  53.     WORD  initialStackSize;
  54.     WORD  initialIP;
  55.     WORD  initialCS;
  56.     WORD  initialSP;
  57.     WORD  initialSS;
  58.     WORD  segmentCount;
  59.     WORD  moduleReferenceCount;
  60.     WORD  nonResNameTableLength;
  61.     WORD  segmentTableOffset;
  62.     WORD  resourceTableOffset;
  63.     WORD  nameTableOffset;
  64.     WORD  moduleRefTableOffset;
  65.     WORD  importNameTableOffset;
  66.     DWORD  nonResNameTableOffset;
  67.     WORD  movableEntryPointCount;
  68.     BYTE  fileAlignmentShift;
  69.     BYTE  junk1, junk2, junk3;
  70.     BYTE  osType;
  71.     BYTE  otherExeFlags;
  72.     WORD  thunkOffset;
  73.     WORD  codeSwapSize;
  74.     BYTE  winMinor, winMajor;
  75. };
  76.  
  77. //=====================================================================
  78. //
  79. // SegmentTable is a segment table entry from a "NE" (new executable)
  80. // file.
  81. //
  82. //=====================================================================
  83.  
  84. struct SegmentTable {
  85.     WORD offsetToSegment;   // relative to beginning of file, shifted by fileAlignmentShift
  86.     WORD length;            // length of data in file
  87.     WORD attributes;        //
  88.     WORD allocatedSize;     // size of segment to allocate
  89. };
  90.  
  91.  
  92. //=====================================================================
  93. //
  94. //  These structures describe the Debug information found in
  95. //  Borland Executables.  This is specific to Borland.
  96. //
  97. //  For more detail about these and how to use them,
  98. //  see the Borland's Open Architecture Handbook
  99. //
  100. //=====================================================================
  101. #define DEBUG_MAGIC 0x52fb
  102.  
  103. struct DebugHeader {
  104.     WORD    magicNumber;        // should be 0x52fb
  105.     WORD    versionId;     
  106.     DWORD   names;
  107.     WORD    namesCount;
  108.     WORD    typesCount;
  109.     WORD    membersCount;
  110.     WORD    symbolsCount;
  111.     WORD    globalsCount;
  112.     WORD    modulesCount;
  113.     WORD    localsCount;
  114.     WORD    scopesCount;
  115.     WORD    linesCount;
  116.     WORD    sourceCount;
  117.     WORD    segmentCount;
  118.     WORD    correlationCount;
  119.     DWORD   imageSize;
  120.     DWORD   debuggerHook;
  121.     BYTE    programFlags;
  122.     WORD    unused1;
  123.     WORD    dataCount;
  124.     BYTE    unused2;
  125.     WORD    extensionSize;
  126. };
  127.  
  128. struct DebugExtHeader {
  129.     WORD    classEntries;
  130.     WORD    parentEntries;
  131.     WORD    globalClasses;
  132.     WORD    overloadEntries;
  133.     WORD    scopeClassEntries;
  134.     WORD    moduleClassEntries;
  135.     WORD    coverageOffsetCount;
  136.     DWORD   namePoolOffset;
  137.     WORD    browserEntries;
  138.     WORD    optSymbolEntries;
  139.     WORD    debugFlags;
  140.     char    unused[8];
  141. };
  142.  
  143. struct DebugSymbol {
  144.     WORD symbolName;
  145.     WORD symbolType;
  146.     WORD symbolOffset;
  147.     WORD symbolSegment;
  148.     WORD symbolClass : 3;
  149.     WORD hasValidBP :1;
  150.     WORD returnAddressWordOffset : 3;
  151. };
  152.  
  153. struct near DebugModule {
  154.     WORD moduleName;
  155.     BYTE language;
  156.     WORD memoryModel:3;
  157.     WORD underbarsOn:1;
  158.     WORD symbolsIndex;
  159.     WORD symbolsCount;
  160.     WORD sourceFilesIndex;
  161.     WORD sourceFilesCount;
  162.     WORD correlationIndex;
  163.     WORD correlationCount;
  164. };
  165.  
  166. struct near DebugSourceFile {
  167.     WORD sourceFileName;
  168.     DWORD timeStamp;
  169. };
  170.  
  171. struct DebugLineNumber {
  172.     WORD lineNumberValue;
  173.     WORD lineNumberOffset;
  174. };
  175.  
  176. struct near DebugScope {
  177.     WORD autosIndex;
  178.     WORD autosCount;
  179.     WORD parentScope;
  180.     WORD functionSymbol;
  181.     WORD scopeOffset;
  182.     WORD scopeLength;
  183. };
  184.  
  185. struct near DebugSegment {
  186.     WORD modIndex;
  187.     WORD codeSegment;
  188.     WORD codeOffset;
  189.     WORD codeLength;
  190.     WORD scopesOffset;
  191.     WORD scopesLength;
  192.     WORD correlationIndex;
  193.     WORD correlationCount;
  194. };
  195.  
  196. struct DebugCorrelation {
  197.     WORD segmentIndex;
  198.     WORD fileIndex;
  199.     WORD linesIndex;
  200.     WORD linesCount;
  201. };
  202.  
  203. #endif
  204.